<template>
  <div class="avue-sidebar">
    <logo></logo>
    <el-scrollbar style="height:100%">
      <div class="avue-sidebar--tip"
           v-if="validatenull(menu)">{{ $t('menuTip') }}
      </div>
      <el-menu :collapse="keyCollapse"
               :default-active="nowTagValue"
               :show-timeout="200"
               mode="vertical"
               unique-opened>
        <sidebar-item :collapse="keyCollapse"
                      :menu="menu"
                      :props="website.menu.props"
                      :screen="screen"
                      first></sidebar-item>
      </el-menu>
    </el-scrollbar>
  </div>
</template>

<script>
import {mapGetters} from "vuex";
import logo from "../logo";
import sidebarItem from "./sidebarItem";
import Cookies from 'js-cookie'

export default {
  name: "sidebar",
  components: {sidebarItem, logo},
  inject: ["index", 'reload'],
  data() {
    return {};
  },
  created() {
    this.index.openMenu();
  },
  computed: {
    ...mapGetters(["website", "menu", "tag", "keyCollapse", "screen", "menuId"]),
    nowTagValue: function () {
      return this.$router.$avueRouter.getValue(this.$route);
    }
  },
  mounted() {
    const web = Cookies.get('web') // 如果有这个值，说明是前台刚过来，
    console.log(web)
    // return
    if (web !== '' && web !== undefined) {
      Cookies.remove('web')
      // this.index.openMenu();
      // window.location.reload()
      // this.reload()
    }
  },
  methods: {}
};
</script>
<style lang="scss" scoped>
</style>

